package com.masterrabbit.mcslf.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 如果订单id为空则代表提现余额变动代表提现或收入
 * @TableName financial_records
 */
@TableName(value ="financial_records")
@Data
public class FinancialRecords implements Serializable {
    /**
     * ID（自增）
     */
    @TableId(type = IdType.AUTO)
    private Integer recordId;

    /**
     * 订单编号
     */
    private String orderNumber;

    /**
     * 商户信息ID（外键）
     */
    private Integer merchantId;

    /**
     * 店铺余额
     */
    private BigDecimal shopBalance;

    /**
     * 累计收入
     */
    private BigDecimal cumulativeIncome;

    /**
     * 累计提现
     */
    private BigDecimal cumulativeWithdrawal;

    /**
     * 余额变动
     */
    private BigDecimal balanceChange;

    /**
     * 变动类型
     */
    private String changeType;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 标头
     */
    private String title;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        FinancialRecords other = (FinancialRecords) that;
        return (this.getRecordId() == null ? other.getRecordId() == null : this.getRecordId().equals(other.getRecordId()))
            && (this.getOrderNumber() == null ? other.getOrderNumber() == null : this.getOrderNumber().equals(other.getOrderNumber()))
            && (this.getMerchantId() == null ? other.getMerchantId() == null : this.getMerchantId().equals(other.getMerchantId()))
            && (this.getShopBalance() == null ? other.getShopBalance() == null : this.getShopBalance().equals(other.getShopBalance()))
            && (this.getCumulativeIncome() == null ? other.getCumulativeIncome() == null : this.getCumulativeIncome().equals(other.getCumulativeIncome()))
            && (this.getCumulativeWithdrawal() == null ? other.getCumulativeWithdrawal() == null : this.getCumulativeWithdrawal().equals(other.getCumulativeWithdrawal()))
            && (this.getBalanceChange() == null ? other.getBalanceChange() == null : this.getBalanceChange().equals(other.getBalanceChange()))
            && (this.getChangeType() == null ? other.getChangeType() == null : this.getChangeType().equals(other.getChangeType()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRecordId() == null) ? 0 : getRecordId().hashCode());
        result = prime * result + ((getOrderNumber() == null) ? 0 : getOrderNumber().hashCode());
        result = prime * result + ((getMerchantId() == null) ? 0 : getMerchantId().hashCode());
        result = prime * result + ((getShopBalance() == null) ? 0 : getShopBalance().hashCode());
        result = prime * result + ((getCumulativeIncome() == null) ? 0 : getCumulativeIncome().hashCode());
        result = prime * result + ((getCumulativeWithdrawal() == null) ? 0 : getCumulativeWithdrawal().hashCode());
        result = prime * result + ((getBalanceChange() == null) ? 0 : getBalanceChange().hashCode());
        result = prime * result + ((getChangeType() == null) ? 0 : getChangeType().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", recordId=").append(recordId);
        sb.append(", orderNumber=").append(orderNumber);
        sb.append(", merchantId=").append(merchantId);
        sb.append(", shopBalance=").append(shopBalance);
        sb.append(", cumulativeIncome=").append(cumulativeIncome);
        sb.append(", cumulativeWithdrawal=").append(cumulativeWithdrawal);
        sb.append(", balanceChange=").append(balanceChange);
        sb.append(", changeType=").append(changeType);
        sb.append(", createTime=").append(createTime);
        sb.append(", title=").append(title);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}